BOOK.DOC by Robert Wallingford, P.E. 2338 N. McVicker Ave. Chicago, IL 60639-2216 Ph. 312-889-1115 Purpose This pair of programs lets you make and display a "COMPUTER BOOK" that contains a maximum of 35 CHAPTERS with up to 99 PAGES in each CHAPTER. In this document a PAGE is a display screen on a computer monitor with a maximum of 25 lines with 80 characters or less per line. To display a specially prepared file with any name like MYBOOK.ME simply enter BOOK MYBOOK.ME and press the enter key. Reading In reading a BOOK the first screen (after a brief, automatically advancing, SHAREWARE commercial message that doesn't appear in the fully registered version), is the INDEX that the author has created just like any other page in the BOOK. This INDEX shows the reader which key to press to begin displaying any chapter in this BOOK. Pressing that key instantly fills the screen with the first PAGE of that CHAPTER. When the reader wants to go on to the next PAGE he/she may do so by pressing either the space bar or the PgDn key. The display doesn't scroll. It simply replaces the old PAGE with the new PAGE. At the end of the CHAPTER, BOOK does not automatically go into the next CHAPTER. It returns the INDEX. The reader chooses the next chapter with another keystroke from the INDEX. If the reader want to back up any number of pages, the PgUp key does it, one PAGE at a time, with the restriction that it won't go back into a previous CHAPTER. At any PAGE in the CHAPTER, if you press the E key (in either the upper or lower case) the INDEX instantly returns, and if you press the E key while displaying INDEX, the program ends and returns control to DOS. MAKING THE BOOK Technically, making a BOOK is almost as easy as reading a BOOK. The truly difficult part of becoming an Author is exercising the creative talent of composition. This includes everything from choosing the subject and style of your masterpiece to composing the content and appearance of each PAGE. If you can get past this stage and compose a simple INDEX of your CHAPTERS, MAKEBOOK.COM will do the rest, creating a single file called BIGBOOK.FIL that contains all of your creative effort in the proper format for display by BOOK.COM. The only restriction on your composing talent is that you can not use the character $ in your text. If you really care why this requirement exists, read the TECHNICAL section of this document. To make your own "BOOK" you will need a WORD PROCESSOR that makes ASCII FILES and MAKEBOOK.COM to combine the individual page files and insert the control characters. The INDEX DISPLAY should give each CHAPTER TITLE and an associated character key for easy accessing. A page can include pictures made from the IBM extended character set. If enough interest is shown in this program, I may make an improved version capable of including the output of a CAD software package. The program fully supports different paths for the COM file and the DATA file. After you compose each PAGE, make it into a unique file named CHAPTERx.Pxx. The first x is a sequential CHAPTER IDENTIFIER and the xx following the P in the filename extension is the sequential, decimal PAGE IDENTIFIER in that CHAPTER. The sequential CHAPTER IDENTIFIERS start with the numbers 0 through 9, followed by the characters A through Z, with the exception of E, which is used by BOOK.COM to exit from a CHAPTER to the INDEX or to exit from the program. The PAGE IDENTIFIER for each chapter begins with 01 and may go as high as 99. These IDENTIFIERS must be sequential with no gaps, or missing IDENTIFIERS because MAKEBOOK.COM assumes that a missing PAGE IDENTIFIER represents the end of a CHAPTER and a missing CHAPTER IDENTIFIER represents the end of the BOOK. CHAPTER 0 was included to provide space for a dedication, Copyright notice, and an explanation of SHAREWARE. Your INDEX must also be present in a file named INDEX.FIL and it should include a table showing which key the reader should use to access each CHAPTER. There is no provision in these programs for "creative" key assignment. MAKEBOOK.COM assumes that the CHAPTER accessed with key H immediately follows the CHAPTER accessed with key G. However, BOOK.COM permits displaying any sequence of CHAPTERS. This flexibility combined with "dummy" CHAPTERS containing only one page that says, "Press Space Bar To Continue." gives the author a great lattitude in the assignment of keys to CHAPTERS. There still must be no gaps or duplications. After you have composed the INDEX and all of the PAGES and properly named all of these files in the active directory, run MAKEBOOK.COM and it will make a new file named BIGBOOK.FIL. You should then rename BIGBOOK.FIL to a name more fitting for your masterpiece. this is necessary because if MAKEBOOK.COM finds a file named BIGBOOK.FIL it assumes that the file is important and it will not overwrite it. While MAKEBOOK.COM is working, it makes frequent comments on its progress. These comments let you confirm that MAKEBOOK.COM is including each chapter and page of your masterpiece in the output file, BIGBOOK.FIL. LEGAL STUFF Copyright (c) 1992 ROBERT WALLINGFORD, 2338 N. McVICKER AVE., CHICAGO, IL 60639-2216. All Rights Reserved. You are free to use, copy and distribute BOOK.COM providing that: NO FEE IS CHARGED FOR USE, COPYING OR DISTRIBUTION. IT IS NOT MODIFIED IN ANY WAY. Clubs and User Groups may charge a nominal fee for expenses and handling while distributing BOOK.COM and MAKEBOOK.COM. Commercial licenses or custom versions of this pair of programs are available. Write to the address below for more details. These programs are provided AS IS without any warranty, expressed or implied, including, but not limited to, fitness for particular purposes. If you find BOOK.COM easy and convenient to use in creating and distributing your own "Computer Book", and becoming a "Famous Author", a contribution would be appreciated. With a contribution of Fifteen Dollars or more you will be registered to receive a diskette with the registered version of BOOK.COM. Please state the current version of BOOK.COM that you have. Send contributions to: ROBERT WALLINGFORD, P.E. 2338 N. McVicker Ave. Chicago, IL 60639-2216 Phone (312)-889-1115 TECHNICAL DETAILS (For those who need to know all of the awful stuff) OVERVIEW This Program lets a user display the contents of a specially prepared file, one page at a time, with the pages subdivided into chapters. The index display lists these chapters with their index keys. When the index is displayed you can directly access any chapter with a single keystroke. You can display successive pages within a chapter in sequence by pressing either the space bar or the PgDn key. The PgUp key lets you back up one page at a time to the beginning of the chapter, but you can't enter the previous chapter. At the end of the chapter the program will automatically return to the index display. At any point in a chapter you may return directly to the index display by pressing E or e (not shift dependent). Pressing E or e while displaying the index ends the program. There is a special "password" provision in the program to prevent the accidental accessing of a file which was not written for BOOK.COM. Except for a small index section at the beginning of the file to be read, BOOK.COM contains all of the required logic. This index section contains three data words for each chapter. They are the number of pages in that chapter, the high bit address of the beginning of the chapter, and the low bit address of the beginning of the chapter. The formation of these data words is described in the INDEX section of this document. The BOOK program reads a PAGE, which contains a maximum of two thousand characters terminated by a DOLLAR SIGN, ascii 36, a CARRIAGE RETURN, ascii 13, and a LINE FEED, ascii 10. (If you use MAKEBOOK.COM to combine your PAGES, it will automatically add these characters with the corrected count.) BOOK displays the PAGE up to, but not including, the DOLLAR SIGN. This is a DOS convention, so don't blame me for it. Therefore you can't use the DOLLAR SIGN, ascii 36, as a displayed character in your "BOOK". The program keeps track of where you are in the file and carries out your instructions such as PAGE UP or PAGE DOWN or EXIT or RETURN TO INDEX or CHAPTER SELECTION, each with a single key stroke. PASSWORD If you use BOOK.COM to access a file that is not a BOOK file you would not hurt anything but the result would be meaningless and it could result in a loop requiring that you reboot the system. To avoid that unpleasant, though remote, possibility BOOK.COM has a protective feature that requires that the word "BOOK", in capital letters, must appear in the data file beginning with the third byte. If this password isn't in your file, the program will give you an appropriate message and return to DOS. When you use MAKEBOOK.COM to make your own BOOK, this step is automatically inserted. OFFSET The OFFSET is the location of a byte in the file. It is the number of bytes from the beginning of the file and you should always express it in hexadecimal numbers. The 1989th byte in a file therefore has an OFFSET of 07C5. A byte is 8 binary digits, or 2 hexadecimal digits. This OFFSET of 07C5 requires two bytes, which is a WORD. When you enter an OFFSET WORD in a file for DOS to read, it is even more complicated. You must put the last two hexadecimal digits first and the first two hexadecimal digits last. In the DOS file this OFFSET WORD looks like C507. OFFSETS that are larger than 65535, or FFFF in hexadecimal, require two WORDS but DOS keeps them in the normal sequence. The 69002th byte therefore has an hexadecimal OFFSET of 00010D8A but in the file it will be 01008A0D. Don't get mad at me. I just wrote the program, not the operating system. If you use MAKEBOOK.COM to combine the file INDEX.FIL and the page files named CHAPTERx.Pxx where x identifies the chapter and the page in that chapter, the program does all of this work. CHAPTER INDEX Most books contain CHAPTERS, or subdivisions, in which one topic or theme is dominant. CHAPTERS contain PAGES, or physical units defined by space limitations. When I refer to a PAGE, I mean one screen of information. Since this program does not scroll, it is like a book with the top of a page always at the top. For books like Instruction Manuals or Collections of Recipes or Poems this is the preferred format. You can make your BOOK more artistic if the reader must always view it from the same perspective. When you make your CHAPTER INDEX you will assign a digit or a letter of the alphabet to each chapter. The keys that evoke these characters are the control keys for starting the desired chapter. These characters may be in any sequence on the INDEX MENU but there must not be any missing characters except E (for exit). This gives you a capacity of up to 35 CHAPTERS of up to 99 PAGES in each chapter. Page numbers begin with 01 and chapter numbers begin with 0 with A following 9 and E reserved for . A missing page indicates the end of a chapter. A missing chapter indicates the end of the book. The INDEX section of the file consists of a series of segments, each containing three digital WORDS. The first WORD is the OFFSET of the last byte of the index section. The second and third WORDS make the password BOOK. The next three WORD segment defines the INDEX MENU. In this segment the first WORD is a one signifying that the INDEX MENU is only one PAGE long and it should look like "0100", (see OFFSET). The other two WORDS are the OFFSET of the first byte of the INDEX MENU. Each following three WORD segment of this section defines a CHAPTER. The first WORD is the number of pages in that CHAPTER and the other two WORDS are the OFFSET of the first byte of the first page of that CHAPTER. It is this sequence of three WORD segments that determines which character will evoke the CHAPTER associated with its OFFSET. The sequence begins with 0 through 9, followed by A through Z. Upper and lower case are the same. Leave the segment for "E" empty since "E" or "e" ends the program. MAKEBOOK.COM will take care of all sequencing and offsets and pages per chapter if all of the page files are present and properly named (CHAPTERx.Pxx) and INDEX.FIL is present. After you organize your material and write it, you will find there are places in your writing that you want the reader to be able to access directly to begin a reading session. These are the most natural places for your CHAPTERS to begin. The INDEX will evoke these sections. The sequence of OFFSETS in this section determines which character will begin the display of each CHAPTER. CHAPTERS in the file may be in any sequence, but PAGES in a CHAPTER must be in the sequence that you wish to display them. Actually, the CHAPTERS don't even have to be adjacent. You can insert secret messages or notes between CHAPTERS and the reader will never see them unless he/she uses an editor to view the file. This might even be a good place to insert your copyright claims as an author. MAKEBOOK.COM does not support this possibility. If you do try it, you will have to change most of the OFFSETS without the aid of MAKEBOOK.COM. PAGES A full page would contain 25 lines with 80 characters in each line. Carriage returns and line feeds could add another 48 characters, but if your line has 80 printable characters the display will automatically "wrap around". Therefore, the maximum number of characters required for a full screen display is 80 X 25 - 1, or 1999. To make sure that this program recovers a full page, it reads 2002 characters into a buffer from the specified file that it has opened only for reading. The program then displays the contents of this buffer memory until it finds a DOLLAR SIGN, ascii 36, that tells it to stop displaying. A display PAGE must contain less than 2000 characters and must end with a DOLLAR SIGN. MAKEBOOK.COM automatically adds this DOLLAR SIGN and the carriage return and line feed for you. You should add your name, or at least three blank spaces at the end of the file. This is because the subroutine that moves the file pointer does not always back up properly when this character is the EOF character. While you are reading the display BOOK.COM counts the number of characters displayed, stores that number plus 3 (for the DOLLAR SIGN, carriage return and line feed). Then it subtracts this number from 2002 and backs up the file pointer that many spaces so it is ready to go for the next page if you press either the space bar or the PgDn key. If you press the PgUp key, BOOK.COM checks to make sure that you are past the first page of a chapter. If you are, it checks it memory to find out how many characters were in the last two pages and backs up the file pointer that many bytes and then reads the previous page again. During this process it is also checking the number of characters read from the open file. Backing up requires this information since the read function stops at the EOF (end of file) character. In summary, BOOK.COM requires a good deal of logic to give you the functional versatility that it provides. If you find these instructions confusing you can learn a lot more by using a good editor and examining the data files included in this package. You can also look at the .BAT files for the proper syntax. Don't forget to make a back up copy for extra safety. DOLLAR SIGN The DOLLAR SIGN, ascii 36, is a special character for the DOS display function. It is like a STOP sign. DOS will continue to fetch characters from its memory and display them until it finds a DOLLAR SIGN. I am just the opposite. it takes a DOLLAR SIGN to start me and the lack of a DOLLAR SIGN will stop me. I am distributing this program under the shareware concept. It costs you nothing to try it but if you continue to use it and you think that it is a good and useful product, you should send me a reasonable contribution. If I receive enough contributions I will produce more and better program for you to use and enjoy. It is a mutual responsibility based on the honor system. If we both honor our responsibility, the whole computer community will be better off. I have taken the first step by producing both MAKEBOOK.COM and BOOK.COM for your use and pleasure. If you think it is a good and useful set of programs, won't you consider giving your financial support to future programs of the same or better quality. The experience that I gain from each program insures that all future programs will be even better.